package com.vterm4aKafka.domain;

import lombok.*;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

/**
 * @ program: elasticSearch_springBoot_study
 * @ description:
 * @ author: Mr.Zhongsf
 * @ create: 2021-03-18 09:55
 **/
@Getter
@Setter
@ToString
@NoArgsConstructor
@AllArgsConstructor
public class FourAInfoReq {


    //一级部门名
    private String deptName;

    //桌面组名称
    /**
     * dgName验证
     */
    @NotNull(message = "dgName不能为空")
    @Length(max = 20,message = "dgName超出长度!")
    @Length(min = 1,message = "dgName不能为空!")
    private String dgName;

    //二级部门名
    /**
     * org2name验证
     */
    @Length(max = 30,message = "secDeptName超出长度!")
    private String secDeptName;

    //工号
    @Length(max = 10,message = "userNumber超出长度!")
    @Pattern(regexp="^[0-9]*$",message="无效的userNumber")
    private String userNumber;

    //4a账号
    private String userId;

    //姓名
    @Length(max = 100,message = "userName超出长度!")
    private String userName;

    //日期时间段
    /**
     * 开始时间验证
     */
    @NotNull(message = "beginTime不能为空")
    @Pattern(regexp = "^((([0-9]{3}[1-9]|[0-9]{2}[1-9][0-9]{1}|[0-9]{1}[1-9][0-9]{2}|[1-9][0-9]{3})-" +
            "(((0[13578]|1[02])-(0[1-9]|[12][0-9]|3[01]))|((0[469]|11)-(0[1-9]|[12][0-9]|30))|" +
            "(02-(0[1-9]|[1][0-9]|2[0-8]))))|((([0-9]{2})(0[48]|[2468][048]|[13579][26])|((0[48]|[2468]" +
            "[048]|[3579][26])00))-02-29))\\s+([0-1]?[0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])$",
            message="beginTime格式错误,时间格式yyyy-MM-dd HH:mm:ss")
    private String beginTime;


    @NotNull(message = "endTime不能为空")
    @Pattern(regexp = "^((([0-9]{3}[1-9]|[0-9]{2}[1-9][0-9]{1}|[0-9]{1}[1-9][0-9]{2}|[1-9][0-9]{3})-" +
            "(((0[13578]|1[02])-(0[1-9]|[12][0-9]|3[01]))|((0[469]|11)-(0[1-9]|[12][0-9]|30))|" +
            "(02-(0[1-9]|[1][0-9]|2[0-8]))))|((([0-9]{2})(0[48]|[2468][048]|[13579][26])|((0[48]|[2468]" +
            "[048]|[3579][26])00))-02-29))\\s+([0-1]?[0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])$",
            message="endTime格式错误,时间格式yyyy-MM-dd HH:mm:ss")
    private String endTime;

    //排序方式  1 按时间先后   0按照时长(默认1 时间升序)
    @NotBlank(message = "sortMethod不能为空")
    @Length(max = 1,message = "sortMethod超出长度")
    @Pattern(regexp="^[0-1]*$",message="无效的sortMethod")
    private String sortMethod;

    //pageHelper
    /**
     * page验证
     */
    @Range(min = 1, max = 99999, message = "page范围应为1-99999")
    private int page;

    /**
     * pageSize验证
     */
    @Range(min = 1, max = 999, message = "pageSize范围应为1-999")
    private int pageSize;

}
